package br.com.ffm.praticas.facade;

import java.sql.SQLException;
import java.util.List;

import br.com.ffm.praticas.bean.ProductType;
import br.com.ffm.praticas.dao.ProductTypeDAO;

public class ProductTypeFACADE {
	
	private static ProductTypeFACADE productTypeFacade;
	private static ProductTypeDAO productTypeDAO;
	
	/**
	 * Constructor of ProductTypeFACADE
	 */
	private ProductTypeFACADE(){
		productTypeDAO = new ProductTypeDAO();
	}
	
	/**
	 * Method that returns an unique instance of ProductTypeFACADE
	 * @return An instance of ProductTypeFACADE
	 */
	public static ProductTypeFACADE getInstance(){
		if(productTypeFacade == null){
			productTypeFacade = new ProductTypeFACADE();
		}
		return productTypeFacade;
	}
	
	/**
	 * Method that returns all inserted ProductTypes
	 * @return All ProductTypes
	 * @throws SQLException
	 */
	public List<ProductType> getProductTypes() throws SQLException{
		return productTypeDAO.getProductTypes();
	}

}
